<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('查看答题场次配置')" />
</head>
<body class="gray-bg">
	
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>查看答题场次配置</h5>
					</div>
					<div class="ibox-content">
						<form class="form-horizontal m" id="form-config-view" th:object="${examSessionConfig}">
							<input name="id" th:field="*{id}" type="hidden">
							<div class="form-group">
								<label class="col-sm-3 control-label">配置名称：</label>
								<div class="col-sm-8">
									<p class="form-control-static" th:text="*{configName}"></p>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">题目数量：</label>
								<div class="col-sm-8">
									<p class="form-control-static" th:text="*{questionCount}"></p>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">题目分类：</label>
								<div class="col-sm-8">
									<p class="form-control-static" id="categoryName">加载中...</p>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">难度筛选：</label>
								<div class="col-sm-8">
									<p class="form-control-static" th:if="*{difficulty} == 0">全部</p>
									<p class="form-control-static" th:if="*{difficulty} == 1">简单</p>
									<p class="form-control-static" th:if="*{difficulty} == 2">中等</p>
									<p class="form-control-static" th:if="*{difficulty} == 3">困难</p>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">考试类型：</label>
								<div class="col-sm-8">
									<p class="form-control-static" th:if="*{examType} == 1">单人答题</p>
									<p class="form-control-static" th:if="*{examType} == 2">PK答题</p>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">考试时长：</label>
								<div class="col-sm-8">
									<p class="form-control-static" th:text="*{examDuration} + '秒'"></p>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">状态：</label>
								<div class="col-sm-8">
									<p class="form-control-static" th:if="*{status} == 0">禁用</p>
									<p class="form-control-static" th:if="*{status} == 1">启用</p>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">创建者：</label>
								<div class="col-sm-8">
									<p class="form-control-static" th:text="*{createBy}"></p>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">创建时间：</label>
								<div class="col-sm-8">
									<p class="form-control-static" th:text="*{createTime}"></p>
								</div>
							</div>
							<div class="form-group">
								<div class="form-control-static col-sm-offset-9">
									<button type="button" class="btn btn-danger" onclick="closeItem()">关闭</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	
	<th:block th:include="include :: footer" />
	
	<script type="text/javascript">
		$(function() {
			// 页面加载时显示当前分类名称
			var categoryId = $("#categoryId").val();
			if (categoryId && categoryId != "0") {
				// 通过AJAX获取分类名称
				$.ajax({
					url: ctx + "system/question/category/list",
					type: "post",
					data: {
						id: categoryId
					},
					success: function(result) {
						if (result.code == 0 && result.rows.length > 0) {
							$("#categoryName").text(result.rows[0].categoryName);
						} else {
							$("#categoryName").text("未知分类");
						}
					},
					error: function() {
						$("#categoryName").text("分类ID: " + categoryId);
					}
				});
			} else {
				$("#categoryName").text("全部分类");
			}
		});
		
		function closeItem() {
			var index = parent.layer.getFrameIndex(window.name);
			parent.layer.close(index);
		}
	</script>
</body>
</html>